/*3:
用户输入任意一个整数，求其所有位上的数字和并输出
比如123，和为6,10000和为1,用for完成*/
package ZUOYE0421;

import java.util.Scanner;

public class 更改作业3 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("输入一个数：");
		int num = in.nextInt();
		int b = 0;
		for (int a = 0; num % 10 != num;) {
			a = num % 10;
			b = b + a;
			num = num / 10;
		}
		System.out.println(b + num);
	}

}
